import{queryString} from '..//tools.js';
import{APIDetail} from '..//fetch.js';

$('#head').load('../dewu/head.html');
$('#foot').load('../dewu/foot.html');

var gid = queryString('gid');

APIDetail({
    gid
}).then(({data:{gname,desc,price,detail,imgs}}) =>{
    console.log(detail);
   var html ='';
   $('.detail h2').html(gname);
   $('.detail-a').html(desc);
   $('.detail-b').html(price);
   $('#main').html(detail);

//    $.each(JSON.parse(imgs),function(index,item){
//        if(index == 0) $('.layui-carousel img').attr('src',item)
    // html +=` 
    // <div><img src="${item}" alt=""></div>
       
    // `
//    })
   $('.layui-carousel').html(imgs);

})
